<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
    <title></title>
    <meta name="keywords" content="games">
    <meta name="description" content="games">
    <style>
        .ul-form li {
            margin: 0;
        }
        .p-btn {
            padding: 0;
        }
    </style>
</head>

<body>

<!-------------------------wrap------------------------------->
<div class="wrap">
    <div class="wrap-wh">

        <div class="clear"></div>
        <p class="line"></p>
        <p class="p-btn"><button type="button" name="btn" class="btn-submit" onclick="WXPayment()" >立即支付</button></p>
    </div>
</div>
<script src="{{ asset('style/plugins/jQuery/jquery-2.1.1.js') }}"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
    var WXPayment = function() {
        $$.ajax({
            url: 'http://schoolshop.weiler.com/wx/cart/pay',
            method: 'POST',
            data: {},
            ajaxSuccess:function (e) {
                console.log(e);
            }
        });
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', <?php echo json_encode($config) ?>, function(res) {
                switch(res.err_msg) {
                    case 'get_brand_wcpay_request:cancel':
                        alert('支付取消！');
                        break;
                    case 'get_brand_wcpay_request:fail':
                        alert('支付失败！（'+res.err_desc+'）');
                        break;
                    case 'get_brand_wcpay_request:ok':
                        alert('支付成功！');
                        break;
                    default:
                        alert('异常错误！');
                        break;
                }
            }
        );
    }
</script>
</body>
</html>